home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Games World / Hot Demos! / DroidWorks demo / dwCD.gob / mission_cog_cap_floodlight.cog < prev    next >
Text File  |  1998-09-17  |  2KB  |  73 lines

  1. # DroidWorks
  2. # Infrared capability cog
  3. #
  4. # Floodlight ability is in inventory bin 11
  5. # Power is in inventory bin 20
  6.  
  7. symbols
  8.  
  9. thing       player
  10. int         actorFlags
  11.  
  12. message     activated
  13. message     pulse
  14.  
  15. sound       lightActivate=NRGt8InfraOn.wav        local
  16. sound       lightDeactivate=NRGt8InfraOff.wav    local
  17.  
  18. end
  19.  
  20. # ========================================================================================
  21.  
  22. code
  23.  
  24. activated:
  25.     player = GetSourceRef();
  26.     actorFlags = GetActorFlags(player);
  27.  
  28.     if(GetInv(player, 11))
  29.     {
  30.         if(BitTest(actorFlags, 4) == 0)
  31.         {
  32.             if(GetInv(player, 20) > 0)
  33.             {
  34.                 # Print("Floodlight activated");
  35.                 SetActorFlags(player, 4);
  36.                 SetInvActivated(player, 11, 1);
  37.                 PlaySoundThing(lightActivate, player, 1.0, -1, -1, 0x80);
  38.                 SetPulse(1.5);
  39.             }
  40.             else
  41.             {
  42.                 # Print("No power for Floodlight");
  43.                 PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
  44.             }
  45.         }
  46.         else
  47.         {
  48.             # Print("Floodlight deactivated");
  49.             ClearActorFlags(player, 4);
  50.             SetInvActivated(player, 11, 0);
  51.             PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
  52.             SetPulse(0);
  53.         }
  54.     }
  55.     return;
  56.  
  57. # ........................................................................................
  58.  
  59. pulse:
  60.     ChangeInv(player, 20, -15);
  61.  
  62.     if(GetInv(player, 20) == 0)
  63.     {
  64.         # Print("No power for Floodlight");
  65.         ClearActorFlags(player, 4);
  66.         SetInvActivated(player, 11, 0);
  67.         PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
  68.         SetPulse(0);
  69.     }
  70.     return;
  71.  
  72. end
  73.